package org.example.Decorator;

/**
 * @author wangbin
 * @date 2024/4/18
 * @vesion 1.0
 */
public class Decorator extends Drink{
    private Drink obj;

    public Decorator(Drink obj) {
        this.obj = obj;
    }

    @Override
    public String getDes() {
        // obj.getDes()输出了被装饰者的信息
        return super.des+""+super.getDes()+"&&"+obj.getPrice();
    }

    @Override
    public float cost() {
        return super.getPrice()+ obj.cost();
    }
}
